function CartModel(data) {
    this.Id = data.Id;
    this.Name = data.Name;
    this.Author = data.Author;
    this.Des = data.Des;
    this.Price = data.Price;
    this.Quantity = data.Quantity ? data.Quantity : 1;
}

CartModel = {
    getTotal : function() {
        return parseFloat(this.Price) * parseInt(this.Quantity, 10);
    }
};

function CartListModel(data) {
    this.list = new Array();
    for (var i = 0; i < data.length; i++) {
        this.list.push(new CartModel(data[i]));
    }
}

CartListModel = {
    getTotal : function() {
        var total = 0;
        for (var i = 0; i < this.list.length; i++) {
            total = total + this.list[i].getTotal();
        }
        return total;
    }
};
